<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/myblog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/myblog/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/myblog/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/myblog/images/logo.svg" color="#222">

<link rel="stylesheet" href="/myblog/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/all.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css">

<script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"baweifan.gitee.io","root":"/myblog/","images":"/myblog/images","scheme":"Pisces","version":"8.3.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"}};
  </script>
<meta name="description" content="1、系统命令runlevel           # 查看当前的运行级别 systemctl status firewalld  # 开启服务功能  ​     stop        # 关闭 ​     restart       # 重启 ​     reload       # 重载 reboot            # 重启 halt             # 关机 poweroff">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux常用命令">
<meta property="og:url" content="http://baweifan.gitee.io/myblog/2021/04/03/2006-day01/index.html">
<meta property="og:site_name" content="IT教育">
<meta property="og:description" content="1、系统命令runlevel           # 查看当前的运行级别 systemctl status firewalld  # 开启服务功能  ​     stop        # 关闭 ​     restart       # 重启 ​     reload       # 重载 reboot            # 重启 halt             # 关机 poweroff">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-04-03T13:06:45.000Z">
<meta property="article:modified_time" content="2021-04-03T13:11:17.865Z">
<meta property="article:author" content="大海老师">
<meta property="article:tag" content="Linux">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="http://baweifan.gitee.io/myblog/2021/04/03/2006-day01/">


<script class="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>
<title>Linux常用命令 | IT教育</title>
  




  <noscript>
  <style>
  body { margin-top: 2rem; }

  .use-motion .menu-item,
  .use-motion .sidebar,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header {
    visibility: visible;
  }

  .use-motion .header,
  .use-motion .site-brand-container .toggle,
  .use-motion .footer { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle,
  .use-motion .custom-logo-image {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line {
    transform: scaleX(1);
  }

  .search-pop-overlay, .sidebar-nav { display: none; }
  .sidebar-panel { display: block; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/myblog/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">IT教育</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/myblog/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-tags"><a href="/myblog/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
        <li class="menu-item menu-item-categories"><a href="/myblog/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
        <li class="menu-item menu-item-archives"><a href="/myblog/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
  </ul>
</nav>




</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#1%E3%80%81%E7%B3%BB%E7%BB%9F%E5%91%BD%E4%BB%A4"><span class="nav-number">1.</span> <span class="nav-text">1、系统命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2%E3%80%81%E6%9F%A5%E7%9C%8B%E6%96%87%E4%BB%B6%E6%8C%87%E4%BB%A4"><span class="nav-number">2.</span> <span class="nav-text">2、查看文件指令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3%E3%80%81%E7%9B%AE%E5%BD%95%E7%AE%A1%E7%90%86%E6%8C%87%E4%BB%A4"><span class="nav-number">3.</span> <span class="nav-text">3、目录管理指令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4%E3%80%81%E8%B4%A6%E5%8F%B7%E4%B8%8E%E6%9D%83%E9%99%90"><span class="nav-number">4.</span> <span class="nav-text">4、账号与权限</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="大海老师"
      src="/myblog/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">大海老师</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/myblog/archives/">
        
          <span class="site-state-item-count">3</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/myblog/categories/">
          
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/myblog/tags/">
          
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/yourname" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;yourname" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://weibo.com/yourname" title="Weibo → https:&#x2F;&#x2F;weibo.com&#x2F;yourname" rel="noopener" target="_blank"><i class="fab fa-weibo fa-fw"></i>Weibo</a>
      </span>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://baweifan.gitee.io/myblog/2021/04/03/2006-day01/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/myblog/images/avatar.jpg">
      <meta itemprop="name" content="大海老师">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="IT教育">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Linux常用命令
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>
      

      <time title="创建时间：2021-04-03 21:06:45 / 修改时间：21:11:17" itemprop="dateCreated datePublished" datetime="2021-04-03T21:06:45+08:00">2021-04-03</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/myblog/categories/%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/" itemprop="url" rel="index"><span itemprop="name">参考资料</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h3 id="1、系统命令"><a href="#1、系统命令" class="headerlink" title="1、系统命令"></a>1、系统命令</h3><p>runlevel           # 查看当前的运行级别</p>
<p>systemctl status firewalld  # 开启服务功能 </p>
<p>​     stop        # 关闭</p>
<p>​     restart       # 重启</p>
<p>​     reload       # 重载</p>
<p>reboot            # 重启</p>
<p>halt             # 关机</p>
<p>poweroff           # 关机</p>
<h3 id="2、查看文件指令"><a href="#2、查看文件指令" class="headerlink" title="2、查看文件指令"></a>2、查看文件指令</h3><p>找一个大文件去验证</p>
<p>cat          # 在命令提示符下查看文件内容</p>
<p>more          # 在命令提示符中分页查看文件内容</p>
<p>less          # 命令行中查看文件可以上下翻页反复浏览</p>
<p>head          # 命令行中查看文件头几行</p>
<p>tail          # 命令行中查看文件尾几行</p>
<p>wc           # 统计文件的单词数 行数等信息</p>
<h3 id="3、目录管理指令"><a href="#3、目录管理指令" class="headerlink" title="3、目录管理指令"></a>3、目录管理指令</h3><p>pwd          # 查看你当前所在的目录</p>
<p>cd           # 切换目录</p>
<p>ls           # 查看显示目录的内容</p>
<p>du           # 统计目录和文件空间的占用情况</p>
<p>mkdir         # 创建新目录</p>
<p>rmdir         # 删除空目录</p>
<p>touch         # 创建文件</p>
<p>rm           # 删除文件</p>
<p>ln           # 创建硬链接    比较意思</p>
<p>ln -s         # 创建软链接</p>
<p>cp           # 复制文件或目录</p>
<p>mv           # 移动文件或目录   </p>
<p>which         # 查看linux命令所在的目录</p>
<p>复制代码</p>
<h3 id="4、账号与权限"><a href="#4、账号与权限" class="headerlink" title="4、账号与权限"></a>4、账号与权限</h3><p>‘’’1.组管理’’’</p>
<p>groupadd group_name               # 创建一个新用户组 </p>
<p>groupdel group_name               # 删除一个用户组 </p>
<p>groupmod -n new_group_name old_group_name    # 重命名一个用户组</p>
<p>‘’’2.用户管理’’’  没有自定义主目录</p>
<p>useradd zhangsan                # 创建账户张三</p>
<p>passwd zhangsan                 # 给用户设置密码</p>
<p>userdel -r zhangsan               # 删除张三及他的宿主目录</p>
<p>‘’’3.用户组管理’’’</p>
<p>gpasswd -a zhangsan root            # 将张三用户加入root组</p>
<p>groups zhangsan                 # 确认zhangsan用户在root组</p>
<p>gpasswd -d lisi root              # 将李zhangsan户从root组中删除</p>
<p>‘’’4.权限管理’’’</p>
<p>chown -R zhangsan /aaa             # 将文件夹/aaa的多有者修改为zhangsan</p>
<p>chown root:root /aaa              # 将/aaa文件夹的属主和属组都改成root</p>
<p>chmod 777 /aaa                 # 给文件夹文件/aaa设置权限为777</p>
<p>Ubuntu 默认没有root账号</p>
<p>实操案例</p>
<p>实例： 查看防火墙开的端口号</p>
<p>1、关闭防火墙</p>
<p>2、开启防火墙</p>
<p>3、列出端口号</p>
<p>4、开启新的端口号</p>
<p>5、关闭端口号</p>
<p>查看ip</p>
<p>适应外部工具连接 </p>
<p>安装一个软件redis</p>
<p>可以通过 本地电脑访问到</p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/myblog/tags/Linux/" rel="tag"># Linux</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/myblog/2021/04/03/hello-world/" rel="prev" title="Hello World">
                  <i class="fa fa-chevron-left"></i> Hello World
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/myblog/2021/04/03/day02/" rel="next" title="Django复习">
                  Django复习 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>







<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      const commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">大海老师</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/pisces/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
<script src="/myblog/js/utils.js"></script><script src="/myblog/js/motion.js"></script><script src="/myblog/js/next-boot.js"></script>

  






  





</body>
</html>
